/*
 * DiscoveryWantToBuyImageProvider.java
 * business
 *
 * Created by ChenTao on 2017/5/16.
 *
 * Copyright (c) 2017年 yidiandao. All rights reserved.
 */

package com.yidiandao.business.ui.widget.recyclerview.provider;

import android.app.Activity;
import android.support.annotation.NonNull;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;

import com.yidiandao.business.R;
import com.yidiandao.business.utils.ImageLoader;

import me.drakeet.multitype.ItemViewProvider;

/**
 * 发现页，求购列表图片
 * <p>
 * Created by ChenTao(chentao7v@gmail.com) on 2017/5/16 0016 9:34
 */
public class DiscoveryWantToBuyImageProvider extends ItemViewProvider<String, DiscoveryWantToBuyImageProvider.ViewHolder> {

    private Activity mActivity;

    public DiscoveryWantToBuyImageProvider(Activity activity) {
        mActivity = activity;
    }

    @NonNull
    @Override
    protected ViewHolder onCreateViewHolder(@NonNull LayoutInflater inflater, @NonNull ViewGroup parent) {
        return new ViewHolder(inflater.inflate(R.layout.item_discovery_want_to_buy_image, parent, false));
    }

    @Override
    protected void onBindViewHolder(@NonNull ViewHolder holder, @NonNull String url) {
        ImageLoader.loadImageWithPlaceHolder(mActivity, holder.imageView, url);
    }

    static class ViewHolder extends RecyclerView.ViewHolder {

        private ImageView imageView;

        public ViewHolder(View itemView) {
            super(itemView);
            imageView = (ImageView) itemView.findViewById(R.id.image_view);
        }
    }
}
